import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 账号与安全
///
class AccountSecurity extends StatefulWidget {
  const AccountSecurity({Key? key}) : super(key: key);

  @override
  State<AccountSecurity> createState() => _AccountSecurityState();
}

class _AccountSecurityState extends State<AccountSecurity> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ColorsUtils.rgba(245, 245, 245),
      appBar: BrnAppBar(
        backgroundColor: ColorsUtils.rgba(255, 110, 83, 1),
        title: Text('账号与安全', style: StylesUtils.customTextStyle(fontSize: Sizes.default18)),
        elevation: 0,
        titleAlignment: Alignment.center,
        themeData: BrnAppBarConfig(
          iconSize: Sizes.default20,
          leadIconBuilder: () {
            return ToolsUtils.getAssetImageIcon('back.png');
          },
          leftAndRightPadding: Sizes.default10,
          titlePadding: EdgeInsets.zero,
        ),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              height: Sizes.default40,
              padding: const EdgeInsets.symmetric(horizontal: Sizes.default15),
              alignment: Alignment.centerLeft,
              child: Text(
                '账号设置',
                style: StylesUtils.customTextStyle(
                    fontSize: Sizes.default12, color: ColorsUtils.color797),
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                color: Colors.white,
              ),
              padding: const EdgeInsets.symmetric(horizontal: Sizes.default15),
              child: Column(
                children: [
                  Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      decoration: BoxDecoration(
                          border: Border(bottom: BorderSide(color: ColorsUtils.rgba(153, 153, 153, 0.095)))
                      ),
                      child: InkWell(
                        onTap: () {
                          Get.toNamed(RouteGet.userMobileUnbind);
                        },
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text('手机号',
                                style: StylesUtils.customTextStyle(
                                    color: ColorsUtils.color363, fontSize: Sizes.default15)),
                            Text.rich(
                              TextSpan(
                                  text: '+86 135*****037',
                                  style: StylesUtils.customTextStyle(
                                      fontSize: Sizes.default15, color: ColorsUtils.color797),
                                  children: [
                                    WidgetSpan(
                                        child: BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow,
                                            Sizes.default16, Sizes.default16),
                                        alignment: PlaceholderAlignment.middle)
                                  ]),
                              textAlign: TextAlign.center,
                              textDirection: TextDirection.ltr,
                              softWrap: true,
                            )
                          ],
                        ),
                      )
                  ),
                  Container(
                    height: Sizes.default50,
                    alignment: Alignment.centerLeft,
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text('邮箱',
                            style: StylesUtils.customTextStyle(
                                color: ColorsUtils.color363, fontSize: Sizes.default15)),
                        Text.rich(
                          TextSpan(
                              text: 'to****@126.com',
                              style: StylesUtils.customTextStyle(
                                  fontSize: Sizes.default15, color: ColorsUtils.color797),
                              children: [
                                WidgetSpan(
                                    child: BrunoTools.getAssetSizeImage(
                                        BrnAsset.iconRightArrow, Sizes.default16, Sizes.default16),
                                    alignment: PlaceholderAlignment.middle)
                              ]),
                          textAlign: TextAlign.center,
                          textDirection: TextDirection.ltr,
                          softWrap: true,
                        )
                      ],
                    ),
                  ),
                ],
              ),
            ),
            Container(
              height: Sizes.default40,
              padding: const EdgeInsets.symmetric(horizontal: Sizes.default15),
              alignment: Alignment.centerLeft,
              child: Text(
                '安全设置',
                style: StylesUtils.customTextStyle(
                    fontSize: Sizes.default12, color: ColorsUtils.color797),
              ),
            ),
            Container(
              decoration: const BoxDecoration(
                color: Colors.white,
              ),
              padding: const EdgeInsets.symmetric(horizontal: Sizes.default15),
              child: Column(
                children: [
                  InkWell(
                    onTap: () {
                      Get.toNamed(RouteGet.userPasswordLogin);
                    },
                    child: Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      decoration: BoxDecoration(
                          border: Border(bottom: BorderSide(color: ColorsUtils.rgba(153, 153, 153, 0.095)))
                      ),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('修改登录密码',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color363, fontSize: Sizes.default15)),
                          BrunoTools.getAssetSizeImage(
                              BrnAsset.iconRightArrow, Sizes.default16, Sizes.default16),
                        ],
                      ),
                    ),
                  ),
                  InkWell(
                    onTap: () {
                      Get.toNamed(RouteGet.userTradeResetPassword);
                    },
                    child: Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      decoration: BoxDecoration(
                          border: Border(bottom: BorderSide(color: ColorsUtils.rgba(153, 153, 153, 0.095)))
                      ),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('修改交易密码',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color363, fontSize: Sizes.default15)),
                          BrunoTools.getAssetSizeImage(
                              BrnAsset.iconRightArrow, Sizes.default16, Sizes.default16),
                        ],
                      ),
                    ),
                  ),
                  InkWell(
                    onTap: () {
                      Get.toNamed(RouteGet.userTradeForgetPassword);
                    },
                    child: Container(
                      height: Sizes.default50,
                      alignment: Alignment.centerLeft,
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text('忘记交易密码',
                              style: StylesUtils.customTextStyle(
                                  color: ColorsUtils.color363, fontSize: Sizes.default15)),
                          BrunoTools.getAssetSizeImage(
                              BrnAsset.iconRightArrow, Sizes.default16, Sizes.default16),
                        ],
                      ),
                    ),
                  )
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
